package cate.game.role.farm.dailyfb.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdDailyFb;
import cate.game.role.farm.dailyfb.DailyFb;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "某副本设置消耗碎钻 の 请求")
public class DailyFbSetSpendReq implements MsgInput {
    @NoteField(value = "副本类型")
    public int type;

    @NoteField(value = "消耗碎钻标记")
    public boolean spendMark;

    @Override
    public MsgConfig conf() {
        return MsgIdDailyFb.DAILYFB_SET_SPEND_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        if (cc.getRole().getFarm().dailyFb.isOpen()){
            DailyFb fb = cc.getRole().getFarm().dailyFb.getFb(type);
            if(fb.playTimes == null)
                fb.initialize(cc.getRole());
            fb.spendMark = spendMark;
            game.notice.message(cc.getRole(),"设置成功");
            cc.getRole().sendNow(new DailyFbOneResp(fb));
            return;
        }
        game.notice.message(cc.getRole(),"功能未开启,设置失败 ");
    }
}
